package com.rico.gallery.message;

import com.alibaba.fastjson.JSON;
import com.rico.gallery.message.IMessage;
import com.rico.gallery.message.MessageType;

import java.io.UnsupportedEncodingException;

public class DeviceLoginMessage extends IMessage {

    private String deviceId;

    private String localIP;

    private int localPort;


    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getLocalIP() {
        return localIP;
    }

    public void setLocalIP(String localIP) {
        this.localIP = localIP;
    }

    public int getLocalPort() {
        return localPort;
    }

    public void setLocalPort(int localPort) {
        this.localPort = localPort;
    }

    @Override
    public byte[] toBytes() {
        try {
            return JSON.toJSONString(this).getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public MessageType getMessageType() {
        return MessageType.CONNECT;
    }
}
